home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 10
/
The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso
/
PC_SIGCD
/
03
/
5
/
DISK0353.ZIP
/
NOISE.ASM
< prev
next >
Wrap
Assembly Source File
|
1984-09-14
|
2KB
|
41 lines
; from ASSEMBLY LANGUAGE PRIMER FOR THE IBM PC & XT
; by Robert LaFore
; modified to be compilable by CHASM (disk # 37)
;GUN--makes a machine gun sound
; fires fixed number of shots
;------------------------------------------
main proc far ;main part of program
mov cx,20 ;set # of shots
new_shot
push cx ;save count
call shoot ;sound of shot
mov cx,4000h ;set up silent delay
silent loop silent ;silent delay
pop cx ;get back shots count
loop new_shot ;loop til done
int 20h ;back to DOS
endp
;------------------------------------------
;subroutine to make brief noise
;------------------------------------------
shoot proc near ;
mov dx,140h ;initial value of wait
mov bx,20h ;set count
in al,61h ;get port 61
and al,0FCh ;"and off" bits 0 and 1
sound xor al,2 ;toggle bit #1 in al
out 61h,al ;output to port 61
add dx,9248h ;add random pattern
mov cl,3 ;get set to rotate 3 bits
ror dx,cl ;rotate it
mov cx,dx ;put it in cx
and cx,1FFh ;mask off upper 7 bits
or cx,10 ;ensure not too short
wait loop wait ;time delay
dec bx ;done enough?
jnz sound ;if not, back to sound
and al,0FCh ;and off bits 0 and 1
out 61h,al ;turn off bits o and 1
ret ;return from subroutine
endp
;------------------------------------------